<%@page import="java.util.List"%>
<%@page import="java.util.ArrayList"%>
<%@page import="com.situ.web.entity.Student"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
	<%
		pageContext.setAttribute("name", "张三");
		request.setAttribute("name", "李四");
		
		Student student = new Student(1,"王五",23,"男");
		session.setAttribute("student",student);
		
		List<Student> list = new ArrayList<Student>();
		Student student1 = new Student(1, "赵六1", 20, "女");
		Student student2 = new Student(2, "赵六2", 21, "男");
		Student student3 = new Student(3, "赵六3", 22, "男");
		list.add(student1);
		list.add(student2);
		list.add(student3);
		application.setAttribute("list", list);
	%>
		
		<!-- 1.获取普通字符串 -->
		<!-- 使用JSP表达式 -->
		<%=pageContext.getAttribute("name") %><br />
		<%=request.getAttribute("name") %><br />
	<!-- 	从范围小的域找起 -->
		<%=pageContext.findAttribute("name") %> <br />
		<!-- 使用EL表达式 -->
		${pageScope.name}<br />
		${requestScope.name}<br />
		${name}
		<hr/>
		
		<!-- 2.Student对象 -->
		<!-- 使用JSP表达式 -->
		<% 
			Student stu = (Student)session.getAttribute("student"); 
		%>
		<%=stu.getName() %>
		<%=stu.getGender() %>
		<%=stu.getAge() %><br />
		<!-- 使用EL表达式 -->
		${sessionScope.student.name}
		${student.age}
		${sessionScope.student.gender}
		${student.id}<br/>
		<hr/>
		
		
		<!-- 3.List<Student> -->
		<!-- 使用JSP表达式 -->
		<%
			List<Student> stuList = (List<Student>)application.getAttribute("list");
		%>
		<%=stuList.get(1).getName()%><br/>
		<%=stuList.get(2).getName() %><br/>
		<!-- 使用EL表达式 -->
		${applicationScope.list[1].name}<br/>
		${list[2].age}<br/>
		${applicationScope.list[0].id}<br/>
		${list[0].gender}<br/>
</body>
</html>